<template>
  <div>
    <el-row type="flex" justify="end">
      <div class="block" style="margin-top: 20px">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[10, 20, 30, 50]"
          :page-size="10"
          layout="prev, pager, next,sizes, jumper"
          :total="total"
        >
        </el-pagination>
      </div>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'Pagination',
  props: {
    total: Number,
    page: Number,
    pagesize: Number
  },
  data () {
    return {
      currentPage: null
    }
  },
  methods: {
    //   每页 ${val} 条
    handleSizeChange (val) {
      this.$emit('update:pagesize', val)
    },
    // 当前页: ${val}
    handleCurrentChange (val) {
      this.currentPage = val
      this.$emit('update:page', val)
    }
  }
}
</script>

<style lang="less" scoped></style>
